import React, { Component, lazy, Suspense } from 'react';

const Header = lazy(() => import('./Header'))

class App extends Component {
  state = {
    num: 3
  }
  render() {
    return (
      <div>
        <Suspense fallback={() => <div>loading...</div>}>
          <Header num={this.state.num}></Header>
        </Suspense>
        <button onClick={() => this.setState({num: 3})}>click</button>
      </div>
    );
  }
}

export default App;